package jpg5.jpg5zad3;

/**
 * Autor: Daniel Michalski
 * Data: 05.07.13
 */

public class Main {
    public static void main(String[] args) {
        Point point1 = new Point(2, 3);
        Point point2 = new Point(1, 3);
        Point point3 = new Point(2, 3);

        System.out.println("czy point1 = point2 ? " + point1.equals(point2));
        System.out.println("czy point2 = point3 ? " + point2.equals(point3));
        System.out.println("czy point1 = point3 ? " + point1.equals(point3));
    }
}

class Point {
    private double x, y;

    Point(double x, double y) {
        this.x = x;
        this.y = y;
    }

    public boolean equals(Point o) {
        if (o == null)
            return false;
        else {
            return (this.x == o.x && this.y == o.y);
        }
    }

    public boolean equalsVer2(Object o) {
        if (o == null || getClass() != o.getClass())
            return false;
        if (x != ((Point)o).x || y != ((Point)o).y)
            return false;

        return true;
    }
}
